<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateFinanceTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('finance', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name');
			$table->integer('project')->index('project');
			$table->integer('inner_cost')->nullable();
			$table->string('inner_cost_currency', 3)->default('RMB');
			$table->integer('external_cost')->nullable();
			$table->string('external_cost_currency', 3)->default('RMB');
			$table->integer('real_cost')->nullable();
			$table->string('real_cost_currency', 3)->default('RMB');
			$table->boolean('approved')->default(0)->index('finance_approved');
			$table->boolean('published')->default(0)->index('finance_published');
			$table->integer('order')->nullable();
			$table->boolean('valid')->default(1);
			$table->timestamps();
			$table->softDeletes();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('finance');
	}

}
